function pairElement(str) {
    const template = [["A", "T"], ["C", "G"]];
    const result = [];
    for (let i = 0, len = str.length; i < len; i++) {
        const pos = template.findIndex(item => item.includes(str[i]));
        const pair = template[pos];
        result.push([
            str[i],
            pair[Math.abs(pair.findIndex(item => item === str[i]) - 1)]
        ]);
    }
    return result;
}

console.log(pairElement("GCG"));
